package Commands

import (
	"fmt"

	"github.com/IBM/sarama"
	"hyper/supports/queue/abstruct"
	"hyper/supports/queue/factories"
)

func KafkaCommandDemo() {

	obj := &abstruct.QueueObj{
		Name: "jybtx",
		Data: nil,
	}

	new(factories.KafkaQueue).New(obj).Consumer(func(msg *sarama.ConsumerMessage) {

		fmt.Printf("Received message: Topic=%s, Partition=%d, Offset=%d, Key=%s, Value=%s\n", msg.Topic, msg.Partition, msg.Offset, string(msg.Key), string(msg.Value))

		fmt.Println(string(msg.Value))

	})

}
